import { Dimensions, Platform, StatusBar, PixelRatio } from 'react-native';

const { width, height } = Dimensions.get('window');
const OS = Platform.OS;
const ios = OS == 'ios';
const android = OS == 'android';
const isIPhoneX = ios && height == 812 && width == 375;
const statusBarHeight = ios ? (isIPhoneX ? 44 : 20) : StatusBar.currentHeight;

global.gScreen = {
	screenWidth: width,
	screenHeight: height,
	statusBarHeight: statusBarHeight,
	onePixelRatio: 1 / PixelRatio.get(),
	backgroundColor: '#f5f5f5',
	wink: 10, // 左右留白
};

// 设备
global.gDevice = {
	ios: ios,
	android: android,
	isIPhoneX: isIPhoneX,
};

// 背景
global.bg = {
	width,
	height,
	backgroundColor: '#FFFFFF',
};

// 水平垂直居中
global.boxCenter = {
	width,
	display: 'flex',
	alignItems: 'center',
	justifyContent: 'center',
};

// 页面样式
global.container = {
	flex: 1,
};

// 阴影
global.boxShadow = {
	elevation: 3, //  设置阴影角度，通过这个设置有无阴影（这个是最重要的，决定有没有阴影）

	shadowColor: 'red', //  阴影颜色

	shadowOffset: { width: 0, height: 0 }, // 阴影偏移

	shadowOpacity: 1, // 阴影不透明度

	shadowRadius: 10, //  圆角
};
